package com.stylefeng.guns.wx;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

import java.util.concurrent.ThreadPoolExecutor;

@SpringBootApplication(scanBasePackages = {"com.stylefeng.guns"})
@EnableScheduling
public class GunsWxApplication {

    public static void main(String[] args) {
        SpringApplication.run(GunsWxApplication.class, args);
    }

    @Bean
    public TaskScheduler taskScheduler(){
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        //线程池大小
        taskScheduler.setPoolSize(2);
        taskScheduler.setThreadNamePrefix("springboot-task");
        return taskScheduler;
    }
}
